package com.zwj.controller;


import com.zwj.bo.StudentBo;
import com.zwj.dto.Result;
import com.zwj.entity.StudentEntity;
import com.zwj.service.StudentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zwj
 * @since 2021-10-30
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    private final StudentService studentService;

    public StudentController(StudentService studentService) {
        this.studentService = studentService;
    }
    //添加学生
    @PostMapping("/addStudent")
    public Result addStudent(@RequestBody StudentEntity studentEntity) {
        return studentService.addStudent(studentEntity);
    }
    //删除学生 逻辑删除
    @PostMapping("/deleteStudent")
    public Result deleteStudent(@RequestBody StudentBo studentBo) {
        return studentService.deleteStudent(studentBo);
    }
    //修改学生
    @PostMapping("/updateStudent")
    public Result updateStudent(@RequestBody StudentEntity studentEntity) {
        return studentService.updateStudent(studentEntity);
    }
    //查询学生
    @PostMapping("/seleteStudent")
    public Result seleteStudent(@RequestBody StudentBo studentBo) {
        return studentService.seleteStudent(studentBo);
    }
}

